package com.szrt.oa.department.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.szrt.oa.base.controller.BaseController;
import com.szrt.oa.department.entity.DepartmentEntity;
import com.szrt.oa.department.service.DepartmentService;
import com.szrt.oa.menu.entity.MenuEntity;
import com.szrt.oa.menu.service.MenuService;


@Controller
@RequestMapping("/department")
public class DepartmentController extends BaseController<DepartmentEntity> {
	
	@Autowired
	private DepartmentService service;
	
	//http://localhost:8090/base-mapper/department/myfindAll.do
	@RequestMapping("/myfindAll")
	@ResponseBody
	public Map<String, Object> myFindAll(){
		
		Map<String, Object> queryAll = service.queryAll();
		return queryAll;
	}
	

	
	//http://localhost:8090/super-base-ssm/department/insert.do?departmentName=test乱码
	//http://localhost:8090/super-base-ssm/department/insert.do
	@RequestMapping("/insert")
	@ResponseBody
	public Map<String, Object> myInsert(DepartmentEntity entity) {
		
		Map<String, Object> insert = service.insert(entity);
		return insert;
	}
	
	
	//http://localhost:8090/super-base-ssm/department/myfind.do?id=1001
	//http://localhost:8090/super-base-ssm/department/myfind.do
	@RequestMapping("/myfind")
	@ResponseBody
	public Map<String, Object> myfind(DepartmentEntity entity) {
		
		Map<String, Object> queryAll = service.queryById(entity);
		return queryAll;
	}
	//http://localhost:8090/super-base-ssm/department/mydeleteByid.do?id=1
	//http://localhost:8090/super-base-ssm/department/mydeleteByid.do
	@RequestMapping("/mydelete")
	@ResponseBody
	public Map<String, Object>  mydeleteByid(DepartmentEntity entity) {
		
		Map<String, Object>  mydelete = service.deleteByid(entity);
				
		return mydelete;
	}
	
	//http://localhost:8090/super-base-ssm/department/myupdate.do?departmentName=lh&id=1
	//http://localhost:8090/super-base-ssm/department/myupdate.do
	@RequestMapping("/myupdate")
	@ResponseBody
	public Map<String, Object>  myupdate(DepartmentEntity entity) {
		
		Map<String, Object>  myupdate = service.update(entity);
		return myupdate;
	}
	
	//http://localhost:8090/super-base-ssm/department/myinsert.do?departmentName=test管理
	//http://localhost:8090/super-base-ssm/department/myinsert.do
	@RequestMapping("/myinsert")
	@ResponseBody
	public Map<String, Object>  myinsert(DepartmentEntity entity) {
		
		Map<String, Object>  myinsert = service.insert(entity);
		return myinsert;
	}

}
